package com.dodoke.domain;

import java.util.Date;

import com.dodoke.common.core.domain.BaseEntity;
import com.dodoke.validateGroup.OnAdd;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.dodoke.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

/**
 * 【微信用户】对象 wx_user
 * 
 * @author dodoke
 * @date 2020-08-25
 */
@ApiModel("微信用户对应的实体类")
public class WxUser extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 主键id */
    @ApiModelProperty(value = "主键id",notes = "不需要给，数据库自动生成",dataType = "Long")
    @Null(message = "id必须为空，由数据库自动创建")
    private Long id;

    /** 微信openId */
    @Excel(name = "微信openId")
    @ApiModelProperty(value = "用户的身份标识openId",dataType = "String",required = true)
    @NotBlank(message = "openId不能为空",groups = {OnAdd.class})
    private String openid;

    /** 昵称 */
    @Excel(name = "昵称")
    @ApiModelProperty(value = "昵称",dataType = "String",required = true)
    @NotBlank(message = "nickName不能为空",groups = {OnAdd.class})
    private String nickName;

    /** 用户头像 */
    @Excel(name = "用户头像")
    @ApiModelProperty(value = "用户头像",dataType = "MultipartFile",required = true)
    @NotBlank(message = "avatar不能为空",groups = {OnAdd.class})
    private String avatar;

    /** 性别 */
    @Excel(name = "性别")
    @ApiModelProperty(value = "性别",dataType = "String",required = true)
    @NotNull(message = "sex不能为空",groups = {OnAdd.class})
    private Integer sex;

    /** 用户登录IP */
    @Excel(name = "用户登录IP")
    private String loginIp;

    /** 登录时间 */
    @Excel(name = "登录时间", readConverterExp = "自动生成")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date loginDate;

    /** 默认为10，代表初始值 */
    @Excel(name = "默认为10，代表初始值")
    private Integer operCount;


    private String code;

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }
    public void setOpenid(String openid) 
    {
        this.openid = openid;
    }

    public String getOpenid() 
    {
        return openid;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public void setAvatar(String avatar)
    {
        this.avatar = avatar;
    }

    public String getAvatar() 
    {
        return avatar;
    }
    public void setSex(Integer sex)
    {
        this.sex = sex;
    }

    public Integer getSex()
    {
        return sex;
    }
    public void setLoginIp(String loginIp) 
    {
        this.loginIp = loginIp;
    }

    public String getLoginIp() 
    {
        return loginIp;
    }
    public void setLoginDate(Date loginDate) 
    {
        this.loginDate = loginDate;
    }

    public Date getLoginDate() 
    {
        return loginDate;
    }
    public void setOperCount(Integer operCount) 
    {
        this.operCount = operCount;
    }

    public Integer getOperCount() 
    {
        return operCount;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("openid", getOpenid())
            .append("nickName",getNickName())
            .append("avatar", getAvatar())
            .append("sex", getSex())
            .append("loginIp", getLoginIp())
            .append("loginDate", getLoginDate())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .append("operCount", getOperCount())
            .toString();
    }
}
